//
//  UIButton+YCTools.h
//  Pods
//
//  Created by Apple on 2022/11/1.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, YCButtonImagePosition) {
    YCButtonImagePositionLeft = 0,              //图片在左，文字在右，默认
    YCButtonImagePositionRight = 1,             //图片在右，文字在左
    YCButtonImagePositionTop = 2,               //图片在上，文字在下
    YCButtonImagePositionBottom = 3,            //图片在下，文字在上
};

@interface UIButton (YCTools)

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        image:(UIImage *)image
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        image:(UIImage *)image
                   otherState:(UIControlState)otherState
                   otherImage:(UIImage *)otherImage
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                      bgColor:(UIColor *)bgColor
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                        image:(UIImage *)image
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                   otherState:(UIControlState)otherState
                   otherTitle:(nullable NSString *)otherTitler
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                   otherState:(UIControlState)otherState
              otherTitleColor:(UIColor *)otherTitleColor
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                      bgColor:(UIColor *)bgColor
                   otherState:(UIControlState)otherState
                 otherBgColor:(UIColor *)otherBgColor
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                      bgColor:(UIColor *)bgColor
                   otherState:(UIControlState)otherState
              otherTitleColor:(UIColor *)otherTitleColor
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                      bgColor:(UIColor *)bgColor
                   otherState:(UIControlState)otherState
                   otherTitle:(nullable NSString *)otherTitler
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                      bgColor:(UIColor *)bgColor
                   otherState:(UIControlState)otherState
              otherTitleColor:(UIColor *)otherTitleColor
                 otherBgColor:(UIColor *)otherBgColor
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                      bgColor:(UIColor *)bgColor
                   otherState:(UIControlState)otherState
                   otherTitle:(nullable NSString *)otherTitle
                 otherBgColor:(UIColor *)otherBgColor
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithFrame:(CGRect)frame
                        title:(NSString *)title
                   titleColor:(UIColor *)titleColor
                         font:(UIFont *)font
                      bgColor:(UIColor *)bgColor
                   otherState:(UIControlState)otherState
                   otherTitle:(nullable NSString *)otherTitle
              otherTitleColor:(UIColor *)otherTitleColor
                 otherBgColor:(UIColor *)otherBgColor
                       target:(id)target
                       action:(SEL)seltor;

+ (UIButton *)buttonWithOnlyText:(NSString *)title
                      titleColor:(UIColor *)titleColor
                            font:(UIFont *)font
                          target:(id)target
                          action:(SEL)seltor;

/**
 *  设置Button的背景色
 */
- (void)setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state;

/**
 *  image和title图文混排
 *
 *  @param  position    图片的位置，默认left
 *  @param  spacing     图片和标题的间隔
 *
 *  @return     返回button最小的size
 *
 *  注意，需要先设置好image、title、fontSize。网络图片需要下载完成后再调用此方法，或设置同大小的placeholder
 */
- (CGSize)setButtonImagePosition:(YCButtonImagePosition)position spacing:(CGFloat)spacing;

/**
 *  快捷设置图片
 */
- (void)setImage:(UIImage *)image imageHL:(UIImage *)imageHL;

/**  扩大buuton点击范围  */
- (void)setEnlargeEdgeWithTop:(CGFloat)top right:(CGFloat)right bottom:(CGFloat)bottom left:(CGFloat)left;

@end

NS_ASSUME_NONNULL_END
